<?php


namespace app\ymsh\controller;
use app\model\Agent as AgentModel;

class Agent extends BaseController
{
    /**
     * 没有绑定的数据
     */
    public function list()
    {


        $params = request()->all();

        //要过滤预付的账号 http://8.129.162.239:8989/zentao/bug-view-4050.html

        $data = \app\ymsh\model\Agent::where('merchant_id', null)
            ->withSearch(\app\ymsh\model\Agent::$withSearch,$params)
            ->leftJoin('agent_channel','agent_channel.agent_id = agent.id')
            ->where('merchant_id',null)
            ->where('agent_channel.template_id',config('app.location_template_id'))
            ->where('settle_type', SETTLE_TYPE_PROFIT)
            ->where('is_relation', AgentModel::IS_RELATION_YES)
            ->group('agent.id')
            ->field('agent.id,agent.company_name,agent.username,agent_channel.name as location_channel_name')
            ->paginate();

        return success('', $data);

    }
}